package com.knight.service;

import com.jfinal.plugin.activerecord.Page;
import com.knight.model.Project;

/**
 * 项目service
 * 
 * @author YQ
 *
 */
public class ProjectsService {
	private static ProjectsService instance = new ProjectsService();

	private ProjectsService() {
	}

	public static ProjectsService getInstance() {
		return instance;
	}

	private final Project dao = new Project().dao();

	/**
	 * 通过菜单Id查询项目
	 * 
	 * @param type
	 * @return
	 */
	public Page<Project> findProjectByMenuId(int pageNum, int pageSize, String menuId) {
		return dao.paginate(pageNum, pageSize, "SELECT *",
				"FROM project WHERE menuId=" + menuId + " ORDER BY createDate DESC");
	}

	/**
	 * 通过id查询
	 * 
	 * @param id
	 * @return
	 */
	public Project findById(String id) {
		return dao.findById(id);
	}

}
